import { defineStore } from 'pinia';
import Theme from './interface/theme';
/**
 * 主题管理
 */
const themeStore = defineStore('themeStore', {
	state: (): Theme => {
		return {
			isCollapse: false,
			setting: false,
			isFooter: true,
			isCrumbs: true,
			isCrumbsIcon: true,
			isDark: false,
			customColor: '#646CFF',
			moduleSize: 'default',
			autoInsertSpace: false,
			messageMax: 3,
			language: 'zh',
			animateMode: 'fade-slide',
		};
	},
	actions: {
		/**
		 * 修改定义的内容
		 * @param name  字段名称
		 * @param value  更改的值
		 */
		changeValue<T>(name: string, value: T) {
			(this as any)[name] = value;
		},
	},
	/**数据持久化配置 这里是当前所有变量都持久化 */
	persist: true,
});
export default themeStore;
